package com.eclink.iot.rfidclient.domain.dto;

import java.util.HashMap;

public class AjaxResult extends HashMap<String, Object> {

    public static AjaxResult success() {
        return success(null);
    }

    public static AjaxResult success(Object data) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.put("success", true);
        if (data !=null) {
            ajaxResult.put("data", data);
        }

        return ajaxResult;
    }

    public static AjaxResult fail(String msg) {
        AjaxResult ajaxResult = new AjaxResult();
        ajaxResult.put("success", false);
        if (msg !=null) {
            ajaxResult.put("msg", msg);
        }

        return ajaxResult;
    }

}
